﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ChatData;

namespace ClientServerCloudOptions
{
    public partial class EditUser : Form
    {
        string thepassword;
        public EditUser(string username, string password)
        {
            InitializeComponent();
            this.kryptonTextBox1.Text = username;
            thepassword = password;
        }
        private void checkpassword()
        {
            if (thepassword != Utils.EncodePasswordToBase64(this.kryptonTextBox2.Text))
            {
                return;
            }
            if (this.kryptonTextBoxnew1.Text != this.kryptonTextBoxnew2.Text)
            {
                return;
            }
            thepassword = this.kryptonTextBoxnew1.Text;
        }
        public string Username
        {
            get { return this.kryptonTextBox1.Text; }
        }
        public string Password
        {
            get { this.checkpassword(); return this.kryptonTextBox2.Text; }
        }

        private void kryptonButtonSave_Click(object sender, EventArgs e)
        {
            this.checkpassword();
            this.DialogResult = DialogResult.Yes;
            this.Close();
        }

        private void kryptonButtonCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

    }
}
